Ext.define('Admin.view.number.NumberAddForm', {
    extend: 'Ext.form.Panel',
    alias: 'widget.numberAddForm',
    requires: [
        'Ext.button.Button',
        'Ext.form.field.Text',
        'Ext.form.field.Checkbox',
        'Ext.form.field.ComboBox',
        'Ext.form.field.Date',
		'Ext.form.field.Time', 
        'Ext.form.field.Number',
        'Ext.form.field.Hidden',
        'Ext.form.field.Picker',
        'Ext.form.field.TextArea',
        'Ext.form.field.File',
        'Ext.form.field.HtmlEditor'
    ],
//因为Window是独立Create的并不属于NumberModelPanel主视图
//所以：必须绑定viewModel才可以刷新Grid数据
//所以：必须绑定ViewController才可以绑定事件
viewModel: {type: 'numberViewModel'},
controller: 'numberViewController',
    //cls: '',

    layout: {
        type:'vbox',
        align:'stretch'
    },

    bodyPadding: 10,
    scrollable: true,

    defaults: {
        labelWidth: 60,
        labelSeparator: ''
    },

   items: [{
        xtype: 'hidden',
        fieldLabel: 'id',
        name:'id'
    },{
        xtype: 'textfield',
        fieldLabel: '用户名',
        name:'userName'
    },{
        xtype: 'hidden',
        fieldLabel: '密码',
        name:'password'
    }, {
        xtype: 'textfield',
        fieldLabel: '真名',
        name:'realName'
    }, {
        xtype: 'textfield',
        fieldLabel: 'Email',
        name:'email'
	},{
        xtype: 'textfield',
        fieldLabel: '电话',
        name:'phone'
    },{
        xtype: 'combobox',
        fieldLabel: '性别',
        name:'sex',
        store:  Ext.create('Ext.data.Store', {
            fields: ['value', 'name'],
            data : [
                {"value":"MALE",    "name":"男"},
                {"value":"FEMALE",  "name":"女"}
            ]
        }),
        queryMode:    'local',
        displayField: 'name',
        valueField:   'value'
    },{
        xtype: 'datefield',
        fieldLabel: '出生日期',
        name:'birthday',
       	format: 'Y/m/d H:i:s'
    },
    {
        xtype: 'datefield',
        fieldLabel: '工作时间',
        name:'workTime',
       	format: 'Y/m/d H:i:s'
    },
    {
        xtype: 'hidden',
        fieldLabel: '工作年数',
        name:'workYear'
    },
    {
        xtype: 'textfield',
        fieldLabel: '身份证号',
        name:'idcard'
    },{
        xtype: 'textfield',
        fieldLabel: '地址',
        name:'address'
    },{
        xtype: 'hidden',
        fieldLabel: '所属部门',
        name:'departmentId'
    },
	  {
    	xtype: 'combobox',
        fieldLabel: '部门名',
        name:'depertmentName',
        store:  Ext.create('Ext.data.Store', {
            autoLoad: true,
    		proxy: {
	        type: "ajax",
	        url:  "department/findAll",
	        reader: {
	            type: "json",
		        rootProperty: "result"
	        }
	    }
        }),
        queryMode:    'local',
        displayField: 'name',
        valueField:   'id',
        emptyText:'--请选择--'
    }
    ],

    bbar: {
        overflowHandler: 'menu',
        items: ['->',{
            xtype: 'button',
            ui: 'soft-green',
            text: '提交',
			handler : 'submitEditForm'
        },{
            xtype: 'button',
            ui: 'soft-red',
            text: '取消',
	        handler :function(bt){
			var win = bt.up('window');
		        if (win) {
		            win.close();
		        }
	        }
        },'->']
    }
});
